<!DOCTYPE html>
<html>
<head>
    <title>XSLTProcessor Example</title>   
    <script type="text/javascript">
        window.onload = function () {
            //use XHR to load
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open("get", "employees.xml", false);
            xmlhttp.send(null);
            var xmldom = xmlhttp.responseXML;
            
            xmlhttp = new XMLHttpRequest();
            xmlhttp.open("get", "employees.xslt", false);
            xmlhttp.send(null);
            var xsltdom = xmlhttp.responseXML;  

            var processor = new XSLTProcessor();
            processor.importStylesheet(xsltdom);

            var fragment = processor.transformToFragment(xmldom, document);
            var div = document.getElementById("divResult");
            
            div.appendChild(fragment);

        }
    </script>           
</head>
<body>
    <p>This example loads employees.xml and transforms it using employees.xslt. 
    This example uses <code>transformToFragment()</code>. The resulting code is then displayed.</p>
    <div id="divResult"></div>
</body>
</html>
